home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / gcc / gcc261c.zoo / objects / stdobjects.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-19  |  3.2 KB  |  120 lines

  1. /* General purpose definitions for the GNU Objective-C Library.
  2.    Copyright (C) 1993,1994 Free Software Foundation, Inc.
  3.  
  4.    Written by:  R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
  5.    Date: May 1993
  6.  
  7.    This file is part of the GNU Objective C Class Library.
  8.  
  9.    This library is free software; you can redistribute it and/or
  10.    modify it under the terms of the GNU Library General Public
  11.    License as published by the Free Software Foundation; either
  12.    version 2 of the License, or (at your option) any later version.
  13.    
  14.    This library is distributed in the hope that it will be useful,
  15.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  17.    Library General Public License for more details.
  18.  
  19.    You should have received a copy of the GNU Library General Public
  20.    License along with this library; if not, write to the Free
  21.    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  22. */ 
  23.  
  24. #ifndef __stdobjects_h_OBJECTS_INCLUDE
  25. #define __stdobjects_h_OBJECTS_INCLUDE
  26.  
  27. #include <objects/config.h>
  28. #include <stdlib.h>
  29. #include <stdarg.h>
  30. #include <objects/objc-gnu2next.h>
  31.  
  32. #if NeXT_runtime
  33.  #include <objc/objc.h>
  34.  #include <objc/objc-class.h>
  35.  #include <objc/objc-runtime.h>
  36.  #ifndef _C_ATOM
  37.   #define _C_ATOM '%'
  38.  #endif
  39.  #define _F_CONST    0x01
  40.  #define _F_IN       0x01
  41.  #define _F_OUT      0x02
  42.  #define _F_INOUT    0x03
  43.  #define _F_BYCOPY   0x04
  44.  #define _F_ONEWAY   0x08
  45.  #define _C_CONST    'r'
  46.  #define _C_IN       'n'
  47.  #define _C_INOUT    'N'
  48.  #define _C_OUT      'o'
  49.  #define _C_BYCOPY   'O'
  50.  #define _C_ONEWAY   'V'
  51.  #define CLASS Class
  52. #else                /* GNU Objective C Runtime */
  53.  #include <objc/objc.h>
  54.  #include <objc/objc-api.h>
  55.  #include <objc/encoding.h>
  56.  #include <objc/sarray.h>
  57.  #include <objc/list.h>
  58.  #define CLASS Class*
  59. #endif
  60.  
  61. #include <objc/Object.h>
  62. #include <objects/objc-malloc.h>
  63.  
  64. /* The following two lines are maintained by the libobjects Makefile */
  65. #define OBJECTS_VERSION 0.1.0
  66. #define OBJECTS_GCC_VERSION 2.6.1
  67.  
  68. extern const char objects_version[];
  69. extern const char objects_gcc_version[];
  70. #if NeXT_cc
  71. extern const char objects_NeXT_cc_version[];
  72. #endif
  73.  
  74. #define LAMBDA(RETTYPE, ARGS, BODY) \
  75. ({RETTYPE __lambda_func ARGS BODY __lambda_func;})
  76.  
  77. #define LAMBDA_VOID_PERFORM(SELECTOR) \
  78. LAMBDA(void, (id _o), {[_o perform: SELECTOR];})
  79.  
  80. #define LAMBDA_ID_PERFORM(SELECTOR) \
  81. LAMBDA(id, (id _o), {return [_o perform: SELECTOR];})
  82.  
  83. #define LAMBDA_BOOL_PERFORM(SELECTOR) \
  84. LAMBDA(BOOL, (id _o), {if ([_o perform:SELECTOR]) return YES; else return NO;})
  85.  
  86.  
  87. #ifndef MAX
  88. #define MAX(a,b) \
  89.        ({typedef _ta = (a), _tb = (b);  \
  90.          _ta _a = (a); _tb _b = (b);     \
  91.          _a > _b ? _a : _b; })
  92. #endif
  93.  
  94. #ifndef MIN
  95. #define MIN(a,b) \
  96.        ({typedef _ta = (a), _tb = (b);  \
  97.          _ta _a = (a); _tb _b = (b);     \
  98.          _a < _b ? _a : _b; })
  99. #endif
  100.  
  101. #ifndef PTR2LONG
  102. #define PTR2LONG(P) (((char*)(P))-(char*)0)
  103. #endif
  104. #ifndef LONG2PTR
  105. #define LONG2PTR(L) (((char*)0)+(L))
  106. #endif
  107.  
  108. /* GNU Object.[hm] defines -compare:, NeXT doesn't, libobjects needs it. */
  109. #if NeXT_runtime
  110. @interface Object (GNUExtensions)
  111. - (int)compare:anotherObject;
  112. - shouldNotImplement:(SEL)op;
  113. @end
  114. #endif /* NeXT_runtime */
  115.  
  116. #endif /* __stdobjects_h_OBJECTS_INCLUDE */
  117.  
  118.  
  119.  
  120.